Rules for integrands of the form(Subscript[P, q])[x] (((a+b (x^2)+c (x^4)))^p)

1:  ∫(Subscript[P, q])[x] (((a+b (x^2)+c (x^4)))^p)dx  when p∈(SuperPlus[ℤ])

Derivation: Algebraic expansion

Rule 1.2.2.5.1: If  p∈(SuperPlus[ℤ]), then

∫(Subscript[P, q])[x] (((a+b (x^2)+c (x^4)))^p)dx  ⟶  ∫ ExpandIntegrand[(Subscript[P, q])[x] (((a+b (x^2)+c (x^4)))^p),x]dx

Program code:

Int[Pq_*(a_+b_.*x_^2+c_.*x_^4)^p_.,x_Symbol] :=
  Int[ExpandIntegrand[Pq*(a+b*x^2+c*x^4)^p,x],x] /;
FreeQ[{a,b,c},x] && PolyQ[Pq,x] && IGtQ[p,0]

2:  ∫(Subscript[P, q])[x] (((a+b (x^2)+c (x^4)))^p)dx  when (Subscript[P, q])[x,0]==0

Derivation: Algebraic simplification

Rule 1.2.2.5.2: If  (Subscript[P, q])[x,0]==0, then

∫(Subscript[P, q])[x] (((a+b (x^2)+c (x^4)))^p)dx  ⟶  ∫x PolynomialQuotient[(Subscript[P, q])[x],x,x] (((a+b (x^2)+c (x^4)))^p)dx

Program code:

Int[Pq_*(a_+b_.*x_^2+c_.*x_^4)^p_,x_Symbol] :=
  Int[x*PolynomialQuotient[Pq,x,x]*(a+b*x^2+c*x^4)^p,x] /;
FreeQ[{a,b,c,p},x] && PolyQ[Pq,x] && EqQ[Coeff[Pq,x,0],0] && Not[MatchQ[Pq,x^m_.*u_. /; IntegerQ[m]]]

3:  ∫(Subscript[P, q])[x] (((a+b (x^2)+c (x^4)))^p)dx  when ¬(Subscript[P, q])[(x^2)]

Derivation: Algebraic expansion

Basis: (Subscript[P, q])[x]==(∑_(k=0)^(q/2))(Subscript[P, q])[x,2 k] (x^(2 k))+x (∑_(k=0)^((q-1)/2))(Subscript[P, q])[x,2 k+1] (x^(2 k))

Note: This rule transforms (Subscript[P, q])[x] into a sum of the form (Subscript[Q, r])[(x^2)]+x (Subscript[R, s])[(x^2)].

Rule 1.2.2.5.3: If ¬(Subscript[P, q])[(x^2)], then

∫(Subscript[P, q])[x] (((a+b (x^2)+c (x^4)))^p)dx  ⟶  ∫ ((∑_(k=0)^(q/2))(Subscript[P, q])[x,2 k] (x^(2 k)))(((a+b (x^2)+c (x^4)))^p)dx+∫ x ((∑_(k=0)^((q-1)/2))(Subscript[P, q])[x,2 k+1] (x^(2 k)))(((a+b (x^2)+c (x^4)))^p)dx

Program code:

Int[Pq_*(a_+b_.*x_^2+c_.*x_^4)^p_,x_Symbol] :=
  Module[{q=Expon[Pq,x],k},
  Int[Sum[Coeff[Pq,x,2*k]*x^(2*k),{k,0,q/2}]*(a+b*x^2+c*x^4)^p,x] + 
  Int[x*Sum[Coeff[Pq,x,2*k+1]*x^(2*k),{k,0,(q-1)/2}]*(a+b*x^2+c*x^4)^p,x]] /;
FreeQ[{a,b,c,p},x] && PolyQ[Pq,x] && Not[PolyQ[Pq,x^2]]

4:  ∫(d+e (x^2)+f (x^4)) (((a+b (x^2)+c (x^4)))^p)dx  when a e-b d (2 p+3)==0 ∧ a f-c d (4 p+5)==0

Rule 1.2.2.5.4: If  a e-b d (2 p+3)==0 ∧ a f-c d (4 p+5)==0, then

∫(d+e (x^2)+f (x^4)) (((a+b (x^2)+c (x^4)))^p)dx  ⟶  ((d x (((a+b (x^2)+c (x^4)))^(p+1)))/a)

Program code:

Int[Pq_*(a_+b_.*x_^2+c_.*x_^4)^p_.,x_Symbol] :=
  With[{d=Coeff[Pq,x,0],e=Coeff[Pq,x,2],f=Coeff[Pq,x,4]},
  d*x*(a+b*x^2+c*x^4)^(p+1)/a /;
 EqQ[a*e-b*d*(2*p+3),0] && EqQ[a*f-c*d*(4*p+5),0]] /;
FreeQ[{a,b,c,p},x] && PolyQ[Pq,x^2] && EqQ[Expon[Pq,x],4]

5:  ∫(d+e (x^2)+f (x^4)+g (x^6)) (((a+b (x^2)+c (x^4)))^p)dx  wfen 3 (a^2) g-c (4 p+7) (a e-b d (2 p+3))==0 ∧ 3 (a^2) f-3 a c d (4 p+5)-b (2 p+5) (a e-b d (2 p+3))==0

Rule 1.2.2.5.5: If  3 (a^2) g-c (4 p+7) (a e-b d (2 p+3))==0 ∧ 3 (a^2) f-3 a c d (4 p+5)-b (2 p+5) (a e-b d (2 p+3))==0, then

∫(d+e (x^2)+f (x^4)+g (x^6)) (((a+b (x^2)+c (x^4)))^p)dx  ⟶  ((x (3 a d+(a e-b d (2 p+3)) (x^2)) (((a+b (x^2)+c (x^4)))^(p+1)))/(3 (a^2)))

Program code:

Int[Pq_*(a_+b_.*x_^2+c_.*x_^4)^p_.,x_Symbol] :=
  With[{d=Coeff[Pq,x,0],e=Coeff[Pq,x,2],f=Coeff[Pq,x,4],g=Coeff[Pq,x,6]},
  x*(3*a*d+(a*e-b*d*(2*p+3))*x^2)*(a+b*x^2+c*x^4)^(p+1)/(3*a^2) /;
 EqQ[3*a^2*g-c*(4*p+7)*(a*e-b*d*(2*p+3)),0] && EqQ[3*a^2*f-3*a*c*d*(4*p+5)-b*(2*p+5)*(a*e-b*d*(2*p+3)),0]] /;
FreeQ[{a,b,c,p},x] && PolyQ[Pq,x^2] && EqQ[Expon[Pq,x],6]

6:  ∫(((Subscript[P, q])[(x^2)])/(a+b (x^2)+c (x^4)))dx  when q>1

Derivation: Algebraic expansion

Rule 1.2.2.5.6: If  q>1, then

∫(((Subscript[P, q])[(x^2)])/(a+b (x^2)+c (x^4)))dx  ⟶  ∫ ExpandIntegrand[(((Subscript[P, q])[(x^2)])/(a+b (x^2)+c (x^4))),x]dx

Program code:

Int[Pq_/(a_+b_.*x_^2+c_.*x_^4),x_Symbol] :=
  Int[ExpandIntegrand[Pq/(a+b*x^2+c*x^4),x],x] /;
FreeQ[{a,b,c},x] && PolyQ[Pq,x^2] && Expon[Pq,x^2]>1

7:  ∫(Subscript[P, q])[(x^2)] (((a+b (x^2)+c (x^4)))^p)dx  when q>1 ∧ (b^2)-4 a c==0

Derivation: Piecewise constant extraction

Basis: If  (b^2)-4 a c==0, then (∂_x)((((a+b (x^2)+c (x^4)))^p)/(((b+2 c (x^2)))^(2 p)))==0

Rule 1.2.2.5.7: If  q>1 ∧ (b^2)-4 a c==0, then

∫(Subscript[P, q])[(x^2)] (((a+b (x^2)+c (x^4)))^p)dx  ⟶  ((((a+b (x^2)+c (x^4)))^(FracPart[p]))/((((4 c))^(IntPart[p])) (((b+2 c (x^2)))^(2 FracPart[p]))))∫(Subscript[P, q])[(x^2)](((b+2 c (x^2)))^(2 p))dx

Program code:

Int[Pq_*(a_+b_.*x_^2+c_.*x_^4)^p_,x_Symbol] :=
  (a+b*x^2+c*x^4)^FracPart[p]/((4*c)^IntPart[p]*(b+2*c*x^2)^(2*FracPart[p]))*Int[Pq*(b+2*c*x^2)^(2*p),x] /;
FreeQ[{a,b,c,p},x] && PolyQ[Pq,x^2] && Expon[Pq,x^2]>1 && EqQ[b^2-4*a*c,0]

8.  ∫(Subscript[P, q])[(x^2)] (((a+b (x^2)+c (x^4)))^p)dx  when q>1 ∧ (b^2)-4 a c≠0

1:  ∫(Subscript[P, q])[(x^2)] (((a+b (x^2)+c (x^4)))^p)dx  when q>1 ∧ (b^2)-4 a c≠0 ∧ p<-1

Derivation: Algebraic expansion and trinomial recurrence 2b

Rule 1.2.2.5.8.1: If  q>1 ∧ (b^2)-4 a c≠0 ∧ p<-1, let (Subscript[Q, q-2])[(x^2)]->PolynomialQuotient[(Subscript[P, q])[(x^2)],a+b (x^2)+c (x^4),x] and d+e (x^2)->PolynomialRemainder[(Subscript[P, q])[(x^2)],a+b (x^2)+c (x^4),x], then

∫(Subscript[P, q])[(x^2)] (((a+b (x^2)+c (x^4)))^p)dx  ⟶  

∫(d+e (x^2)) (((a+b (x^2)+c (x^4)))^p)dx+∫(Subscript[Q, q-2])[(x^2)] (((a+b (x^2)+c (x^4)))^(p+1))dx  ⟶  

((x (((a+b (x^2)+c (x^4)))^(p+1)) (a b e-d ((b^2)-2 a c)-c (b d-2 a e) (x^2)))/(2 a (p+1) ((b^2)-4 a c)))+
(1/(2 a (p+1) ((b^2)-4 a c)))∫(((a+b (x^2)+c (x^4)))^(p+1))(2 a (p+1) ((b^2)-4 a c) (Subscript[Q, q-2])[(x^2)]+(b^2) d (2 p+3)-2 a c d (4 p+5)-a b e+c (4 p+7)(b d-2 a e) (x^2) dx

Program code:

Int[Pq_*(a_+b_.*x_^2+c_.*x_^4)^p_,x_Symbol] :=
  With[{d=Coeff[PolynomialRemainder[Pq,a+b*x^2+c*x^4,x],x,0],
        e=Coeff[PolynomialRemainder[Pq,a+b*x^2+c*x^4,x],x,2]},
  x*(a+b*x^2+c*x^4)^(p+1)*(a*b*e-d*(b^2-2*a*c)-c*(b*d-2*a*e)*x^2)/(2*a*(p+1)*(b^2-4*a*c)) + 
  1/(2*a*(p+1)*(b^2-4*a*c))*Int[(a+b*x^2+c*x^4)^(p+1)*
    ExpandToSum[2*a*(p+1)*(b^2-4*a*c)*PolynomialQuotient[Pq,a+b*x^2+c*x^4,x]+
      b^2*d*(2*p+3)-2*a*c*d*(4*p+5)-a*b*e+c*(4*p+7)*(b*d-2*a*e)*x^2,x],x]] /;
FreeQ[{a,b,c},x] && PolyQ[Pq,x^2] && Expon[Pq,x^2]>1 && NeQ[b^2-4*a*c,0] && LtQ[p,-1]

2:  ∫(Subscript[P, q])[(x^2)] (((a+b (x^2)+c (x^4)))^p)dx  when q>1 ∧ (b^2)-4 a c≠0 ∧ p≮-1

Reference: G&R 2.160.3

Derivation: Trinomial recurrence 3a with A=0, B=1 and m=m-n

Reference: G&R 2.104

Note: If  q≥2 ∧ p≮-1, then 2 q+4 p+1≠0.

Rule 1.2.2.5.8.2: If  q>1 ∧ (b^2)-4 a c≠0 ∧ p≮-1, let e->(Subscript[P, q])[(x^2),q], then

∫(Subscript[P, q])[(x^2)] (((a+b (x^2)+c (x^4)))^p)dx  ⟶  

∫((Subscript[P, q])[(x^2)]-e (x^(2 q))) (((a+b (x^2)+c (x^4)))^p)dx+e∫(x^(2 q)) (((a+b (x^2)+c (x^4)))^p)dx  ⟶  

((e (x^(2 q-3)) (((a+b (x^2)+c (x^4)))^(p+1)))/(c (2 q+4 p+1)))+(1/(c (2 q+4 p+1))) ∫(((a+b (x^2)+c (x^4)))^p)·
(c (2 q+4 p+1) (Subscript[P, q])[(x^2)]-a e (2 q-3) (x^(2 q-4))-b e (2 q+2 p-1) (x^(2 q-2))-c e (2 q+4 p+1) (x^(2 q)))dx

Program code:

Int[Pq_*(a_+b_.*x_^2+c_.*x_^4)^p_,x_Symbol] :=
  With[{q=Expon[Pq,x^2],e=Coeff[Pq,x^2,Expon[Pq,x^2]]},
  e*x^(2*q-3)*(a+b*x^2+c*x^4)^(p+1)/(c*(2*q+4*p+1)) + 
  1/(c*(2*q+4*p+1))*Int[(a+b*x^2+c*x^4)^p*
    ExpandToSum[c*(2*q+4*p+1)*Pq-a*e*(2*q-3)*x^(2*q-4)-b*e*(2*q+2*p-1)*x^(2*q-2)-c*e*(2*q+4*p+1)*x^(2*q),x],x]] /;
FreeQ[{a,b,c,p},x] && PolyQ[Pq,x^2] && Expon[Pq,x^2]>1 && NeQ[b^2-4*a*c,0] && Not[LtQ[p,-1]]

S:  ∫(Subscript[P, q])[x] (((a+b x+c (x^2)+d (x^3)+e (x^4)))^p)dx  when  (d^3)-4 c d e+8 b (e^2)==0 ∧ p∉(SuperPlus[ℤ])

Derivation: Integration by substitution

Basis: If  (d^3)-4 c d e+8 b (e^2)==0, then  (((a+b x+c (x^2)+d (x^3)+e (x^4)))^p)==Subst[(((a+((d^4)/(256 (e^3)))-((b d)/(8 e))+(c-((3 (d^2))/(8 e))) (x^2)+e (x^4)))^p),x,(d/(4 e))+x] (∂_x)((d/(4 e))+x)

Rule: If  (d^3)-4 c d e+8 b (e^2)==0 ∧ p∉(SuperPlus[ℤ]), then

∫(Subscript[P, q])[x](((a+b x+c (x^2)+d (x^3)+e (x^4)))^p)dx  ⟶  Subst[∫(Subscript[P, q])[x-(d/(4 e))] (((a+((d^4)/(256 (e^3)))-((b d)/(8 e))+(c-((3 (d^2))/(8 e))) (x^2)+e (x^4)))^p)dx,x,(d/(4 e))+x]

Program code:

Int[Pq_*Q4_^p_,x_Symbol] :=
  With[{a=Coeff[Q4,x,0],b=Coeff[Q4,x,1],c=Coeff[Q4,x,2],d=Coeff[Q4,x,3],e=Coeff[Q4,x,4]},
  Subst[Int[SimplifyIntegrand[ReplaceAll[Pq,x->-d/(4*e)+x]*(a+d^4/(256*e^3)-b*d/(8*e)+(c-3*d^2/(8*e))*x^2+e*x^4)^p,x],x],x,d/(4*e)+x] /;
 EqQ[d^3-4*c*d*e+8*b*e^2,0] && NeQ[d,0]] /;
FreeQ[p,x] && PolyQ[Pq,x] && PolyQ[Q4,x,4] && Not[IGtQ[p,0]]